import { z } from "zod";
import { EVENT_TYPE_IDENTIFIERS } from "../../schemas/typeIdentifiers";

/**
 * Event type identifiers follow the taxonomy system defined in ./taxonomy.ts.
 * Format: `<provenance>.<domain>.<aggregate-type>.<event-name>`
 *
 * Example: "lw.obs.span_ingestion.recorded"
 * - `lw`: Provenance (LangWatch)
 * - `obs`: Domain (Observability)
 * - `span_ingestion`: Aggregate type
 * - `recorded`: Event name
 */

/**
 * Array of all event types (for backwards compatibility).
 * Derived from schemas to ensure single source of truth.
 */
export const EVENT_TYPES = EVENT_TYPE_IDENTIFIERS;

/**
 * Zod schema for event type identifiers.
 * Built from type arrays defined in schemas.
 */
export const EventTypeSchema = z.enum(EVENT_TYPES);

/**
 * Strongly-typed event type identifiers.
 *
 * Event types follow the taxonomy system (see ./taxonomy.ts):
 * `<provenance>.<domain>.<aggregate-type>.<event-name>`
 *
 * This type is inferred from the zod schema, which is built from type arrays
 * defined in schemas. Schemas are the single source of truth for type identifiers.
 */
export type EventType = z.infer<typeof EventTypeSchema>;
